package com.hw.esay.myExam;

import java.util.Scanner;
//蛇形矩阵

/**
 * 你需要输出一个n行n列的上三角形蛇形矩阵。
 */
public class HJ35shuzuxiabiao {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
            int n = scan.nextInt();
            int [][] result = new int[n][];
            int t= 1;
            for (int i = 0; i <n ; i++) {
                //数组第i行有n-i个元素
                result[i] = new int[n-i];
                for (int j = 0; j <i+1 ; j++) {
                    result[i-j][j] = t;
                    t++;
                }
            }
            for (int[] ints : result) {
                for (int anInt : ints) {
                    System.out.print(anInt+" ");
                }
                System.out.println();
            }
        }
    }
}
